from django.conf.urls import url
from rest_framework.routers import DefaultRouter

from . import views

urlpatterns = [
    # url(r'^tucaos/$', views.TucaoView.as_view()),  # 吐槽列表
    url(r'^tucaos/(?P<pk>\d+)/$', views.TucaoRetrieveView.as_view()),  # 吐槽详情
    url(r'^tucaos/(?P<tucao_id>\d+)/comments/$', views.TucaoCommentViewSet.as_view({'get': 'list','post':'create'})),  # 吐槽评论
    # url(r'^tucaos/(?P<tucao_id>\d+)/comments/$', views.TucaoCommentViewSet.as_view({'post': 'create'})),  # 吐槽评论发布
    url(r'^tucaos/follows/$', views.TucaoFollowView.as_view()),  # 吐槽点赞
    url(r'^tucaos/comments/follows/$', views.CommentFollowView.as_view()),  # 评论点赞
    url(r'^tucaos/collections/$', views.TucaoCollectView.as_view()),  # 吐槽收藏
    url(r'^tucaos/hots/$', views.HotTucaoView.as_view()),  # 热门吐槽
]

# 创建默认路由
router = DefaultRouter()
# 注册视图集
router.register(r'tucaos', views.TucaoViewSet, base_name='tucaos')

router.register('tucaos/search', views.TucaoSearchViewSet, base_name='tucaos_search')

urlpatterns += router.urls

